package com.wancaijinfu.parse;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.wancaijinfu.javabean.PageData;
import com.wancaijinfu.javabean.ReadPaper;

public class ReadPaperListParse  extends PostParse{

	
	@Override
	public Object parseSuccess(JSONObject object) throws JSONException {
		PageData data = new PageData();
		if (object.has("lastPage"))
			data.isLast = object.getBoolean("lastPage");
		JSONArray  readpaperlist = object.getJSONArray("list");
		List<ReadPaper> list = new ArrayList<ReadPaper>();
		for (int i = 0; i < readpaperlist.length(); i++) {
			JSONObject newObj = readpaperlist.getJSONObject(i);
			ReadPaper item = new ReadPaper();
			item.id=newObj.getString("id");
			item.account=newObj.getDouble("account");
			item.thawtime=newObj.getString("thawtime");
			item.addtime = newObj.getString("addtime");
			list.add(item);
		}
		data.datas = list;
		return data;
	}
		
	
	

}
